package com.example.combwyaq.visualinterface.video.entity;

import com.example.combwyaq.mvp.model.entity.BaseEntity;
import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

public class VideoNewsEntity extends BaseEntity {
    public String values;

    public List<Values> getValues() {
        List<Values>list = new ArrayList<>();
        if (values==null)
            return null;
        try {
            JSONArray jsonArray = new JSONArray(values);
            for(int i =0;i < jsonArray.length();i ++){
                String str = jsonArray.getString(i);
                Values value = new Gson().fromJson(str,Values.class);
                list.add(value);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return list;
    }

    public static class Values{
        public int news_type;
        public String news_author;
        public String news_value;
        public String news_title;
        public String news_url;
        public long news_time;
        public long author_id;
        public long channel_id;
        public long news_id;
        public List<MediaValues> medias;
    }

    public static class MediaValues{
        public int media_type;
        public long media_id;
        public String media_url;

    }
}
